//
//  addCartNumTableViewCell.m
//  ShouYi
//
//  Created by yrapp on 16/3/14.
//  Copyright © 2016年 yurui. All rights reserved.
//

#import "addCartNumTableViewCell.h"

@implementation addCartNumTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
 
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        _lineView = [[UIView alloc] initWithFrame:CGRectMake(10, 0, kWidth - 20, 1.5)];
        _lineView.backgroundColor = [UIColor colorWithRed:236.0/255 green:237.0/255 blue:239.0/255 alpha:1];
        [self.contentView addSubview:_lineView];
        
        
        UILabel *shuliang = [[UILabel alloc] initWithFrame:CGRectMake(10, 30, 30, 20)];
        shuliang.text = @"数量";
        [shuliang sizeToFit];
        [self.contentView addSubview:shuliang];
        
        _plusButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _plusButton.frame = CGRectMake(kWidth - 45, 0, 45, 71.5);
        [_plusButton setImage:[UIImage imageNamed:@"加"] forState:(UIControlStateNormal)];
        _plusButton.imageEdgeInsets = UIEdgeInsetsMake(20, -0.5, 20, 10);
        [self.contentView addSubview:_plusButton];
        
        _numField = [[UITextField alloc] initWithFrame:CGRectMake(kWidth - 45 - 33.5, 20, 33.5, 31.5)];
        _numField.layer.borderColor = [UIColor colorWithRed:181.0/255 green:181.0/255 blue:181.0/255 alpha:1].CGColor;
        _numField.layer.borderWidth = 1.5;
        _numField.keyboardType = UIKeyboardTypeNumberPad;
        _numField.text = @"1";
        _numField.textAlignment = NSTextAlignmentCenter;
        _numField.tag  = 3000;
        [self.contentView addSubview:_numField];
        
        _deleButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _deleButton.frame = CGRectMake(kWidth - 45 - 33.5 - 45, 0, 45, 71.5);
        [_deleButton setImage:[UIImage imageNamed:@"减"] forState:(UIControlStateNormal)];
        _deleButton.imageEdgeInsets = UIEdgeInsetsMake(20, 10, 20, -0.5);
        [self.contentView addSubview:_deleButton];
        
        
    }
    
    return self;
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
